package com.rui.prototype.model;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Student implements Serializable, Cloneable {

    private String name;
    private String sex;
    private Integer age;

    public static void main(String[] args) throws Exception {
        Student stu1 = new Student("张三", "男", 18);
        Student stu2 = (Student) stu1.clone();
        stu2.setName("李四");
        System.out.println(stu1);// Student(name=张三, sex=男, age=18)
        System.out.println(stu2);// Student(name=李四, sex=男, age=18)
    }

    @Override
    protected Object clone() throws CloneNotSupportedException {
        return super.clone();
    }
}